Make android apps

Course- Android >

How to make android apps

In this page, you will learn which software is required to run Android application on the Eclipse IDE. Here, you will be able to know how to install Android SDK and ADT plugin for the Eclipse IDE. Let's install the software list manually for the Eclipse IDE.

  • Create the new android project
  • Write the message (optional)
  • Run the android application

Hello Android Example

You need to follow the 3 steps mentioned above for creating the Hello android application.

1) Create the New Android project

For creating the new android project:

1) Select File > New > Project...

2) Select the android project and click next

create android app

3) Fill the Details in this dialog box and click finish

Now an android project have been created. You can explore the android project and see the simple program, it looks like this:

2) Write the message


For writing the message we are using the TextView class. Change the onCreate method as:
TextView textview=new TextView(this);  
textview.setText("Hello Android!");  
setContentView(textview);  

Let's see the full code of MainActivity.java file.


package com.example.helloandroid;  
import android.os.Bundle;  
import android.app.Activity;  
import android.view.Menu;  
import android.widget.TextView;  
public class MainActivity extends Activity {  
    @Override  
    protected void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);  
        TextView textview=new TextView(this);  
        textview.setText("Hello Android!");  
        setContentView(textview);  
    } 
    @Override  
    public boolean onCreateOptionsMenu(Menu menu) {  
        // Inflate the menu; this adds items to the action bar if it is present.  
        getMenuInflater().inflate(R.menu.activity_main, menu);  
        return true;  
    }  
}  

To understand the first android application, visit the next page (internal details of hello android example).

3) Run the android application

To run the android application: Right click on your project > Run As.. > Android Application

The android emulator might take 2 or 3 minutes to boot. So please have patience. After booting the emulator, the eclipse plugin installs the application and launches the activity. You will see something like this:

output